#! /usr/bin/python
# coding: utf-8

from Tkinter import *

root = Tk()

t = Text(root)

for i in range(10):
    t.insert(1.0, '0123456789\n')

t.pack()

def undoText():
    t.edit_undo()

def insertText():
    t.insert(1.0, 'insert text')

Button(root, text='undo', command=undoText).pack(fill=X)

Button(root, text='insert text', command=insertText).pack(fill=X)

root.mainloop()
